Count the Number of Duplicate Characters

67

Count the Number of Duplicate Characters -

using System.Linq;

public class Program
{
    public static int DuplicateCount(string str)
    {
			return str.ToCharArray()
				.GroupBy(x => x)
				.Where(x => x.Count() > 1)
				.Count();
    }
}

Comments

Submit
0 Comments